package etnorservice.etnor_service.controller;

import etnorservice.etnor_service.domain.RoleDomain;
import etnorservice.etnor_service.result.Result;
import etnorservice.etnor_service.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: cc
 * @Date: 2025/03/24/14:45
 **/
@RestController
public class RoleController {

    @Autowired
    private RoleService roleService;

    /**
     * 获取角色列表
     */
//    @GetMapping("/system/role/list")
//    public Result<List<RoleDomain>> getRoleList() {
//        List<RoleDomain> roles = roleService.getRoleList();
//        return Result.success(roles);
//    }

    /**
     * 新增角色
     */
    @PostMapping("/system/role/create")
    public Result<RoleDomain> addRole(@RequestBody RoleDomain role) {
        RoleDomain savedRole = roleService.addRole(role);
        return Result.success(savedRole);
    }

    /**
     * 更新角色
     */
//    @PutMapping("/system/role/{id}")
//    public Result<Void> updateRole(@PathVariable Integer id, @RequestBody RoleDomain role) {
//        role.setId(id);
//        roleService.updateRole(role);
//        return Result.success(null);
//    }

    /**
     * 删除角色
     */
//    @DeleteMapping("/system/role/{id}")
//    public Result<Void> deleteRole(@PathVariable Integer id) {
//        roleService.deleteRole(id);
//        return Result.success(null);
//    }
//
//    /**
//     * 获取单个角色
//     */
//    @GetMapping("/{id}")
//    public Result<RoleDomain> getRole(@PathVariable Integer id) {
//        RoleDomain role = roleService.getRole(id);
//        return Result.success(role);
//    }
}